package cn.edu.nwsuaf.examcenter.controller;

import java.util.List;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import cn.edu.nwsuaf.examcenter.model.Student;
import cn.edu.nwsuaf.examcenter.pojo.College;

@Controller
@RequestMapping(value="/test")
public class TestController {
	
	/****
	 * 解决试卷答案提交模块
	 * @param collegeList
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/test01",method=RequestMethod.POST)
	public String test01(@RequestBody College[] collegeList){
		for(College college:collegeList){
			System.out.println(college.getCollegeNo());
			System.out.println(college.getCoolegeName());
		}
		return "success";
	}
	
	@ResponseBody
	@RequestMapping(value="/test02",method=RequestMethod.POST)
	public String test02(@RequestParam(value="file")MultipartFile file,@ModelAttribute Student student){
		if(file.getOriginalFilename().equals("")){
			return "error";
		}else{
			return "success";
		}
	}
}
